<?php
     //引入配置文件
	 require './public/config.php';
	 require './public/mysql.php';
     session_start();
	 @$name= $_SESSION['admin']['user'];
//	 var_dump($name);

    //连接数据库
     $link= connect();
	 
	 //将顶级的分类作为首页导航
	 $sql ="select * from category where pid = 0";
	 if($link['error']){
	    //执行查询的操作
		$navs = query($link['mess'],$sql);
	 }
     
    //查询商品
    $sql="select * from goods where is_sale = 1 limit 4";
	if($link['error']){
	    //执行查询的操作
		$sagoods = query($link['mess'],$sql);
	 }
//	 var_dump($sagoods);

	 $sql="select * from goods where is_new = 1 limit 4";
	if($link['error']){
	    //执行查询的操作
		$goodss = query($link['mess'],$sql);
	 }
//	 var_dump($goodss);
      $sql="select * from goods where is_hot =1 limit 4";
	  if($link['mess']){
	      //执行查询操作
		  $hotgoods=query($link['mess'],$sql);
	  }
//	  var_dump($hotgoods);
?>

<html>
    <head>
	    <title>首页</title>
		<meta charset="utf-8">
		<link type="text/css" rel="stylesheet" href="./web/style/reset.css">
		<link type="text/css" rel="stylesheet" href="./web/style/main.css">
	</head>

    <body>
	    <div class="headerBar">
		
		<div class="topBar">
		        <div class="comWidth">
				  <?php if (empty($_SESSION['admin']['user']) ) :?>
					<a href="./web/login.php">登录</a>
					<a href="./web/adduser.php">注册</a>
					<?php else :?>
					<p>欢迎回来，<?php echo $_SESSION['admin']['user'];?>
					<a href="./web/dologin.php?a=logout">退出</a></p>
					<?php endif;?>
				</div>
		</div>

         <div class="logoBar">
		      <div class="comWidth">
			      <div class="logo fl">
				    <a href="#"><img src="./web/images/logo.jpg" alt="汤浅蓄电池"></a>
				  </div>
				  <div class="search_box fl">
				      <input type="text" class="search_text fl">
					  <input type="button" value="搜 索" class="search_btn fr">
				  </div>
				  <div class="shopCar fr">
				      <span class="shopText fl">购物车</span>
					  <span class="shopNum fl">0</span>
				  </div>
			  </div>
		 </div>

          <div class=navBox>
		      <div class="comWidth">
			        <div class="shopClass fl">
					<h3><i></i>全部商品分类</h3>
                     <div  class="shopClass_show">
	
					 <dl  class="shopClass_item ">
					          <dt><a href="#" class="b">卡罗拉</a><a href="#" class="b">皇冠</a> <a href="#" class="aLink">汉兰达</a></dt>
							   <dd><a href="#">汤浅</a><a href="#">瓦尔塔</a><a href="#">风帆</a></dd>
					 </dl>
					 <dl>
					 		 <dl  class="shopClass_item">
					          <dt><a href="#" class="b">卡罗拉</a><a href="#" class="b">皇冠</a> <a href="#" class="aLink">汉兰达</a></dt>
							   <dd><a href="#">汤浅</a><a href="#">瓦尔塔</a><a href="#">风帆</a></dd>
					 </dl>
					 <dl>
					 		 <dl  class="shopClass_item">
					          <dt><a href="#" class="b">卡罗拉</a><a href="#" class="b">皇冠</a> <a href="#" class="aLink">汉兰达</a></dt>
							   <dd><a href="#">汤浅</a><a href="#">瓦尔塔</a><a href="#">风帆</a></dd>
					</dl>
					 <dl>
					 		 <dl  class="shopClass_item">
					          <dt><a href="#" class="b">卡罗拉</a><a href="#" class="b">皇冠</a> <a href="#" class="aLink">汉兰达</a></dt>
							   <dd><a href="#">汤浅</a><a href="#">瓦尔塔</a><a href="#">风帆</a></dd>
					</dl>
					 </div>

                    <div  class="shopClass_list hide">
					          <dl class="shopList_item">
							      <dt>汤浅</dt>
							      <dd>
								       <a href="##">65D23L</a><a href="##">80D26L</a><a href="##">56093</a><a href="##">55D23L</a><a href="##">55B24L</a><a href="##">55B24R</a>
								  </dd>
							  </dl>
							  <dl class="shopList_item">
							      <dt>汤浅</dt>
							      <dd>
								       <a href="##">65D23L</a><a href="##">80D26L</a><a href="##">56093</a><a href="##">55D23L</a><a href="##">55B24L</a><a href="##">55B24R</a>
								  </dd>
							  </dl>
							    <dl class="shopList_item">
							      <dt>汤浅</dt>
							      <dd>
								       <a href="##">65D23L</a><a href="##">80D26L</a><a href="##">56093</a><a href="##">55D23L</a><a href="##">55B24L</a><a href="##">55B24R</a>
								  </dd>
							  </dl>
							    <dl class="shopList_item">
							      <dt>汤浅</dt>
							      <dd>
								       <a href="##">65D23L</a><a href="##">80D26L</a><a href="##">56093</a><a href="##">55D23L</a><a href="##">55B24L</a><a href="##">55B24R</a>
								  </dd>
							  </dl>
							    <dl class="shopList_item">
							      <dt>汤浅</dt>
							      <dd>
								       <a href="##">65D23L</a><a href="##">80D26L</a><a href="##">56093</a><a href="##">55D23L</a><a href="##">55B24L</a><a href="##">55B24R</a>
								  </dd>
							  </dl>
							     <dl class="shopList_item">
							      <dt>汤浅</dt>
							      <dd>
								       <a href="##">65D23L</a><a href="##">80D26L</a><a href="##">56093</a><a href="##">55D23L</a><a href="##">55B24L</a><a href="##">55B24R</a>
								  </dd>
							  </dl>
							     <dl class="shopList_item">
							      <dt>汤浅</dt>
							      <dd>
								       <a href="##">65D23L</a><a href="##">80D26L</a><a href="##">56093</a><a href="##">55D23L</a><a href="##">55B24L</a><a href="##">55B24R</a>
								  </dd>
							  </dl>
							     <dl class="shopList_item">
							      <dt>汤浅</dt>
							      <dd>
								       <a href="##">65D23L</a><a href="##">80D26L</a><a href="##">56093</a><a href="##">55D23L</a><a href="##">55B24L</a><a href="##">55B24R</a>
								  </dd>
							  </dl>
                            <div>
							
							</div>
					 </div>
					</div>

                    <ul class="nav fl">
					      <li><a href="##" class="active">首页</a></li>
						  <?php foreach ($navs as $val) :?>
					      <li><a href="./web/listpro.php?id=<?php echo $val['id']?>"><?php echo $val['name']?></a>
						    <div>
						      <div>雅阁</div>
						      <div>C-RV</div>
						      <div>X-RV</div>
						      <div>思域</div>
						  </div>
						  
						  
						  </li>
					    
					<?php  endforeach;?>
					</ul>
			  </div>
		  </div>
		  </div>
	</div>
    <div class=" banner comWidth learfix">
	    <div class="banner_bar">
		     <ul class="imgBox">
 			      <img src="./web/images/tq100.jpg" alt="banner">
 </ul>
		</div>
	</div>

	<div class="shopTit comWidth">
	       <span fl></span><h3>汤浅 · 品质出行</h3>
		   <a href="#" class="more">更多&gt;&gt</a>
	</div>
    <div class="shopList comWidth learfix">
	  <div class="leftArea">
       <img src="./web/images/cb1.jpg">
	  </div>
       
<div class="list-shopping">
					<ul>
                          <?php foreach ($sagoods as $val) :?>
						<li>
							<div class="bigPic">
							<?php
									$path = './public/upload/'.$val['pic'];
								?>
								<a href="#"><img src="<?php echo $path;?>" alt=""></a>
								<a class="bigPic-des" href="#"><h2><?php echo $val['name']?></h2><span><?php echo $val['price']?>元</span></a>
							</div>
								</li>
                          <?php endforeach;?>
							  <?php foreach ($goodss as $val) :?>
							<li style="height:150px;">
							<div class="smallPic">
							<?php
							     $path = './public/upload/' .$val['pic'];
							?>
									<a href="#" class="sPic"><img src="<?php echo $path;?>" alt=""></a>
								<a href="#" class="sPic-des"><?php echo $val['name']?></a> 
								<h3 class="smallPic-price"><span>￥</span><?php echo $val['price']?></h3>
							</div>
							 
						</li>
                      <?php endforeach;?>
						
					</ul>
				</div>
	</div>

<!-- 负列表 -->
	<div class="shopTit comWidth">
	       <span fl></span><h3>汤浅 · 放心出行</h3>
		   <a href="#" class="more">更多&gt;&gt</a>
	</div>
    <div class="shopList comWidth learfix">
	  <div class="leftArea">
       <img src="./web/images/cb2.jpg">
	  </div>
       
<div class="list-shopping">
							<ul>
                          <?php foreach ($hotgoods as $val) :?>
						<li>
							<div class="bigPic">
							<?php
									$path = './public/upload/'.$val['pic'];
								?>
								<a href="#"><img src="<?php echo $path;?>" alt=""></a>
								<a class="bigPic-des" href="#"><h2><?php echo $val['name']?></h2><span><?php echo $val['price']?>元</span></a>
							</div>
								</li>
                          <?php endforeach;?>
							  <?php foreach ($goodss as $val) :?>
							<li style="height:150px;">
							<div class="smallPic">
							<?php
							     $path = './public/upload/' .$val['pic'];
							?>
									<a href="#" class="sPic"><img src="<?php echo $path;?>" alt=""></a>
								<a href="#" class="sPic-des"><?php echo $val['name']?></a> 
								<h3 class="smallPic-price"><span>￥</span><?php echo $val['price']?></h3>
							</div>
							 
						</li>
                      <?php endforeach;?>
						
					</ul>
				</div>
	</div>

    
<!--底部   -->
                           <div class="hr"></div>
						 <div class="footer">
                            <p><a href="#">汤浅简介</a><i>|</i><a href="#">招兵买马</a><i>|</i><a href="#">汤浅新闻</a><i>|</i><a href="#">广告与市场合作</a><i>|</i><a href="#">联系我们</a></p>
                            <p>© 2004-2016 beixing.cn Corporation, All Rights Reserved 北星苏州有限公司 版权所有 苏ICP备11004912号</p>
                            <p class="web"><a href="#"><img src="./web/images/chengxin.png" alt="logo"><a><a href="#"><img src="./web/images/chengxin.png" alt="logo"><a><a href="#"><img src="./web/images/chengxin.png" alt="logo"><a><a href="#"><img src="./web/images/chengxin.png" alt="logo"><a><a href="#"><img src="./web/images/chengxin.png" alt="logo"><a></p>
						</div>

















<script>(function(T,h,i,n,k,P,a,g,e){g=function(){P=h.createElement(i);a=h.getElementsByTagName(i)[0];P.src=k;P.charset="utf-8";P.async=1;a.parentNode.insertBefore(P,a)};T["ThinkPageWeatherWidgetObject"]=n;T[n]||(T[n]=function(){(T[n].q=T[n].q||[]).push(arguments)});T[n].l=+new Date();if(T.attachEvent){T.attachEvent("onload",g)}else{T.addEventListener("load",g,false)}}(window,document,"script","tpwidget","//widget.thinkpage.cn/widget/chameleon.js"))</script>
<script>tpwidget("init", {
    "flavor": "bubble",
    "location": "WTW3SJ5ZBJUY",
    "geolocation": "enabled",
    "position": "top-right",
    "margin": "10px 10px",
    "language": "zh-chs",
    "unit": "c",
    "theme": "chameleon",
    "uid": "U9D7975005",
    "hash": "cf7e18d5eda6d121ea7cff0e54bd74d0"
});
tpwidget("show");</script>










	</body>
</html>